// filepath: /d:/aiWorkspace/video-generation-app/video-generation-app/src/api/video-api.ts
import axios from './axios-config';

export const generateVideo = async (imageFile: File, textInput: string) => {
  const formData = new FormData();
  formData.append('image', imageFile);
  formData.append('text', textInput);

  try {
    const response = await axios.post('/ai/video/generate', formData, {
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    });

    return response.data.videoUrl;
  } catch (error) {
    throw new Error('Failed to generate video. Please try again.');
  }
};